package top.oylan.manager.mapper;

import java.util.ArrayList;
import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import top.oylan.manager.entity.*;
import top.oylan.manager.entity.example.ProductExample;
import top.oylan.manager.entity.extend.BookCondition;
import top.oylan.manager.entity.extend.WatchedExtend;
import top.oylan.manager.entity.mp.MpRecommended;
import top.oylan.manager.entity.mp.MpVideo;
import top.oylan.manager.tools.Pager;

@Mapper
public interface ProductMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table product
     *
     * @mbg.generated Sun Mar 03 17:34:22 CST 2019
     */
    long countByExample(ProductExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table product
     *
     * @mbg.generated Sun Mar 03 17:34:22 CST 2019
     */
    int deleteByExample(ProductExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table product
     *
     * @mbg.generated Sun Mar 03 17:34:22 CST 2019
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table product
     *
     * @mbg.generated Sun Mar 03 17:34:22 CST 2019
     */
    int insert(Product record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table product
     *
     * @mbg.generated Sun Mar 03 17:34:22 CST 2019
     */
    int insertSelective(Product record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table product
     *
     * @mbg.generated Sun Mar 03 17:34:22 CST 2019
     */
    ArrayList<Product> selectByExample(ProductExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table product
     *
     * @mbg.generated Sun Mar 03 17:34:22 CST 2019
     */
    Product selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table product
     *
     * @mbg.generated Sun Mar 03 17:34:22 CST 2019
     */
    int updateByExampleSelective(@Param("record") Product record, @Param("example") ProductExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table product
     *
     * @mbg.generated Sun Mar 03 17:34:22 CST 2019
     */
    int updateByExample(@Param("record") Product record, @Param("example") ProductExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table product
     *
     * @mbg.generated Sun Mar 03 17:34:22 CST 2019
     */
    int updateByPrimaryKeySelective(Product record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table product
     *
     * @mbg.generated Sun Mar 03 17:34:22 CST 2019
     */
    int updateByPrimaryKey(Product record);

    Course findCourseByPrimaryKey(Integer id);

    List<Course> selectCourseByPager(Pager pager);

    List<Video> selectVideoByPager(Pager pager);

    ArrayList<Video> selectProductByPager(Pager pager);

    List<Recommended> selectRecommendByType(@Param("type") int type,@Param("offset") Integer offset,@Param("page") Integer page);

    Integer deleteRecommendByType(Byte type);

    Integer setRecommend(@Param("type")Byte type, @Param("ids") List<Integer> ids);

    int deleteRecommendById(int id);

    List<MpRecommended> selectRecommendForMp();

    MpVideo findVideoById(@Param("id") Integer id,@Param("userId")Integer userId);

    Product findBaseInfoById(Integer id);

    List<WatchedExtend> selectMyCourseByPager(Pager pager);

    List<WatchedExtend> selectMyWatched(Integer userId);

    List<Book> selectBooksByPager(Pager pager);

    int creaseLiked(@Param("itemId") Integer itemId,@Param("inc") int inc);

    int watch(@Param("id") Integer id);

    int countMyBooks(BookCondition condition);
    List<Book> selectMyBooksByPager(Pager pager);
}